#include "SceneAutoView.h"
#include "Game.h"

SceneAutoView::SceneAutoView(void)
{
}


SceneAutoView::~SceneAutoView(void)
{
}


void SceneAutoView::init(){
		Game * game =Game::getInstance();
		//Light *l = game->mSceneMgr->createLight("MainLight");
		//l->setPosition(20,80,50);

		SceneNode* theNode= game->mSceneMgr->getRootSceneNode()->createChildSceneNode("theNode");
		//theNode->setPosition(game->mSceneMgr->getRootSceneNode()->getChild("head")->getPosition());
		game->mCamera->setPosition(130,100,170);

		game->mCamera->lookAt(theNode->getPosition());

		theNode->attachObject(game->mCamera);


		SceneAutoViewListener * lis = new SceneAutoViewListener(game->mRoot,game->mCamera, 
			game->mSceneMgr,game->mWindow,theNode,game->mKeyboard,game->mInputManager);

		frameListener = lis;
		keyListener = lis;
		//MouseListener = lis;
		windowEventListener=lis;

	
}


void SceneAutoView::stateStarted() {
	Ogre::WindowEventUtilities::addWindowEventListener(Game::getInstance()->mWindow, this->windowEventListener);
	Game::getInstance()->mRoot->addFrameListener(this->frameListener);
	Game::getInstance()->mMouse->setEventCallback(this->MouseListener);
	Game::getInstance()->mKeyboard->setEventCallback(this->keyListener);
}

void SceneAutoView::stateEnded() {

}
